<?php
$output = "";
$output .= "<h1>Search something</h1><br>";
$output .= "<form action='#' method='post'>";
$output .= "<table width=80%>";
$output .= "<tr>";
$output .= "<th>Search for</th>";
$output .= "<th></th>";
$output .= "</tr>";
$output .= "<tr>";
$output .= '<td><input type="text" size="100%" name="searchstring"></td>';
$output .= "<td><input type=submit name='search' value='Search' /></td>";
$output .= "</tr>";
$output .= "</table></form><br><br>";

if(!empty($_POST['searchstring'])){
	$movies = searchMovie($_POST['searchstring']);
	$actors = searchActor($_POST['searchstring']);
	$regisseurs = searchRegisseur($_POST['searchstring']);
	$output .= "<h1>Results</h1><br><br>";
	$output .= "<b>Movies</b><br><ul>";
	while($movie = mysql_fetch_array($movies)){
		$output .= "<li>";
		$output .= '<a style="color:black;text-decoration:none;" href="index.php?site=movie&movieid='.$movie['movie_id'].'">'.ucfirst(lighton($movie['title'],$_POST['searchstring'])).'</a>';
		$output .= "</li>";
	}
	$output .= "</ul><br>";
	$output .= "<b>Actors</b><br><ul>";
	while($actor = mysql_fetch_array($actors)){
		$output .= "<li>";
		$output .= lighton($actor['name'],$_POST['searchstring']);
		$output .= "</li>";
	}
	$output .= "</ul><br>";
	$output .= "<b>Regisseur</b><br><ul>";
	while($regisseur = mysql_fetch_array($regisseurs)){
		$output .= "<li>";
		$output .= lighton($regisseur['name'],$_POST['searchstring']);
		$output .= "</li>";
	}
	$output .= "</ul><br>";
}

//Output
echo $output;
?>